/**
 * Created by crystal on 2016/10/23.
 */

window.onload = function () {
    getData();
    initPicture();
}

$(document).ready(function () {
    var certificate_id = $("#certificate_id");
    var business_type = $("#business_type");
    var business_id = $("#business_id");
    var business_state = $("#business_state");
    var lender_id = $("#lender_id");
    var lender_name = $("#lender_name");
    var handle_state = $("#handle_state");
    var mortage_amount = $("#mortage_amount");
    var mortage_item = $("#mortage_item");
    var remark = $("#remark");

    $("#submit").click(function () {
        var data = {
            certificate_id: certificate_id,
            business_type: business_type,
            business_id: business_id,
            business_state: business_state,
            lender_id: lender_id,
            lender_name:lender_name,
            handle_state: handle_state,
            mortage_amount: mortage_amount,
            mortage_item: mortage_item,
            reamark: remark
        };
        $.ajax({
            type:"POST",
            url:"khjl_input.json",
            dataType:"application/json",
            contentType:charset="utf-8",
            data: JSON.stringify(data),
            success:function (msg) {
                alert("msg");
            },
            error:function () {
                alert("fail");
            }
        });
    });
    
    
    $("#reset").click(function () {
        document.getElementsById("reset").reset();
    })
});

//页面大小自适应
$(function () {
    windowHeight();
});

function windowHeight() {
    var height = $(document).height();
    var width = $(document).width();
    //var p = getElementsByTagName("body");
    $('#contain').css({"height": height,"width": width});
    //p.css({"height": height,"width": width});
}

$(window).resize(function () {
    windowHeight();
})